New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore SIGINT and SIGQUIT in non-interactive background processes #6861
Ignore SIGINT and SIGQUIT in non-interactive background processes #6861
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to the new test (which is great), in 866d506 I added a fish_test_helper
command to print blocked signals, that would be an easy littlecheck test to write.
> status job-control none
> fish_test_helper print_blocked_signals
Interrupt: 2
Quit: 3
src/exec.cpp
Outdated
/// Call fork() as part of executing a process \p p in a job \j. Execute \p child_action in the | ||
/// context of the child. Returns true if fork succeeded, false if fork failed. | ||
static bool fork_child_for_process(const std::shared_ptr<job_t> &job, process_t *p, | ||
const dup2_list_t &dup2s, const char *fork_type, | ||
const std::function<void()> &child_action) { | ||
pid_t pid = execute_fork(); | ||
if (pid == 0) { | ||
sigset_t sigmask; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's unify signal manipulation under child_setup_process
- see the call to signal_reset_handlers
. I think you can probably just replace that call outright with one that sets a sigmask, which you compute.
CHANGELOG.md
Outdated
@@ -4,6 +4,7 @@ | |||
- `fish --no-execute` will no longer complain about unknown commands or non-matching wildcards, as these could be defined differently at runtime (especially for functions). #977 | |||
- `jobs --quiet PID` will no longer print 'no suitable job' if the job for PID does not exist (e.g. because it has finished). #6809 | |||
- A variable `fish_kill_signal` will be set to the signal that terminated the last foreground job, or `0` if the job exited normally. | |||
- Control-C no longer kills background jobs started in config.fish (#6828). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also say what the underlying change here is, and why (to match POSIX).
04be846
to
7305929
Compare
Otherwise it would print "Unknown Signal" on Linux. I didn't see an obvious way to check signal validity, plus it hardly matters. Also mimic the output from BSD strsignal on Linux.
7305929
to
db99c72
Compare
Fixes #6828
TODOs: